import axiosInstance from "../axiosInstance";
const userInfo = {
    uploadUserPhoto(file) {
        // 文件上传第一步：要借用于FormData的对象
        let formData = new FormData();
        formData.append("user_photo", file)
        // 文件上传第二步：一定是post请求
        return axiosInstance.post("/userInfo/uploadUserPhoto", formData, {
            // 文件上传第三步：一定要指定请求头
            headers: {
                "Content-Type": "multiple/form-data"
            }
        })
    },
    add({ nickName, user_sex, user_phone, user_email, user_photo, password }) {
        return axiosInstance.post("/userInfo/add", {
            nickName, user_sex, user_phone, user_email, user_photo, password
        })
    },

    /**
     * 检查登录
     * @param {{zh,password}} param0 
     * @returns {Promise<object>}
     */
    checkLogin({ zh, password }) {
        return axiosInstance.post("/userInfo/checkLogin", {
            zh, password
        })
    }
}


export default userInfo;